[% setvar title Perl should have a print operator %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>Perl should have a print operator</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>  Maintainer: Jon Ericson &lt;<a href='mailto:Jonathan.L.Ericson@jpl.nasa.gov'>Jonathan.L.Ericson@jpl.nasa.gov</a>&gt;
  Date: 5 Aug 2000
  Last Modified: 20 Sept 2000
  Mailing List: <a href='mailto:perl6-language-io@perl.org'>perl6-language-io@perl.org</a>
  Number: 39
  Version: 4
  Status: Retracted</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p>Perl supplies an operator for line input - angle brackets.  This is no
analogous operator for output.  I propose &quot;inverse angle brackets&quot;:</p>
<pre>    &gt;&quot;Print this line.\n&quot;&lt;;</pre>
<a name='NOTES ON RETRACTION'></a><h1>NOTES ON RETRACTION</h1>
<p>It seems that I am alone in loving the proposed syntax.  It's short, it
works the way I want, it fits into my brain.  As a matter of fact, I've
found myself trying to use it in code that I am currently working on.
But this RFC suffers a fatal flaw - perl already has a perfectly good
print operator.  Perl is a language designed to be spoken by people, so
it should be comfortable to people (even if they don't think exactly
like me :).</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<a name='Easy things should be easy'></a><h2>Easy things should be easy</h2>
<p>Output is already easy in Perl, but it could be easier.  For one thing,
it doesn't nest well in statements:</p>
<pre>    while (&lt;&gt;){
      print;
      push @line, $_;
    };</pre>
<p>This could be written:</p>
<pre>    push @line, &gt;$_&lt; while &lt;&gt;;</pre>
<p>Printing to STDOUT and some other file ala tee(1):</p>
<pre>    print $fh &gt;&quot;This also goes to stdout.\n&quot;&lt;;</pre>
<p>Another problem with print is that the ()s are optional.  perlop points
out the following traps:</p>
<pre>    print $foo, exit;
    print ($foo &amp; 255) + 1, &quot;\n&quot;;</pre>
<p>They could be correctly written as:</p>
<pre>    &gt;$foo&lt;, exit;
    &gt;($foo &amp; 255) + 1, &quot;\n&quot;&lt;;</pre>
<a name='Ugly as a virtue'></a><h2>Ugly as a virtue</h2>
<p>A representative comment of this RFC is &quot;Ick!&quot; -- Jonathan Scott Duff
&lt;<a href='mailto:duff@cbi.tamucc.edu'>duff@cbi.tamucc.edu</a>&gt;  This RFC doesn't mind (nor does its maintainer).
The print operator should be quick and dirty - used as an afterthought
or side-effect.  When you are looking for it, the print operator should
stick out.  When you are looking for something else (and have gotten
used to the syntax), it should blend into the sea of punctuation.  Do
you remember when you first saw &lt;FH&gt;, or i++ (in C)?  Compact syntax
with side-effects, such as the print operator, should be ugly.</p>
<p>This operator _will_ be misused, just as `STRING` (qx/STRING/) is
misused.  It will cause confusion just as the conditional operator (?:)
causes confusion.  It will be as jarring as =~ is to those who have
never seen it.  Perl is operator rich whether you like it or not.</p>
<a name='print will still be there'></a><h2>print will still be there</h2>
<p>Not all output is suited for inverse angle brackets.  Most output will
still go through print.  Prints to files should use 'print FH LIST' so
that the return value can be checked (and the filehandle specified).
Long documents should be printed with the expanded form on their own
lines so that they are emphasised.  'print &quot;Hello world\n&quot;;' should
remain the canonical 'first Perl script'.  We still need print for
practical and stylistic reasons.</p>
<a name='IMPLEMENTATION'></a><h1>IMPLEMENTATION</h1>
<p>Let:</p>
<pre>    &gt;LIST&lt;</pre>
<p>print LIST to the default output filehandle (normally STDOUT) and return
LIST.  It should have the same precedence as other list operators</p>
<a name='Migration from Perl 5'></a><h2>Migration from Perl 5</h2>
<p>Inverse angle brackets are currently a syntax error, so no translation
will be needed.</p>
<a name='Changes'></a><h1>Changes</h1>
<ul>
<li><a name='v4'></a>v4</li>
<p>Retracted</p>
<li><a name='v3'></a>v3</li>
<p>Added &quot;Developing&quot; status
Operator now returns its arguments
Changed DESCRIPTION to respond to concerns voiced about previous
versions</p>
<li><a name='v2'></a>v2</li>
<p>Changed title
Added other symbols section
Added migration section
Added RFC 51 reference</p>
</ul>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<p>RFC 2: Request For New Pragma: Implicit</p>
<p>RFC 34: Angle brackets should not be used for file globbing</p>
<p>RFC 51: Angle brackets should accept filenames and lists</p>
<p>perlop</p>
<p>perlfunc/print</p>
<p>perldebug/&quot;Debugger Commands&quot;/{p,x}</p>
</div>
